$(document).ready(function(){
	$('#rating-recipes').children().click(function(){
		var a = $(this).attr("id");
		$.ajax({
			url : siteUrl+"recipes/do_rating",
			type: "POST",
			data : {id:a},
			success: function(data, status, msg)
			{
				console.log(msg.responseText);
				$('#rating-recipes').fadeOut();
				$('#rating-recipes .message').html(unescape(msg.responseText));
				$('#rating-recipes').fadeIn();
				setTimeout("hideMesg();", 2000);
			},
			error: function (msg, status, errorThrown)
			{
		 		alert(msg.responseText.message);
			}
		});
		return false;
	});
});

function hideMesg(){
	$('.rating_message').fadeOut();
}